<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>如何用SVG图形元素绘制可视化图表</title>
  <style>
    .box{
      width: 50px;
      height: 50px;
      background: green;
      fill: red;
    }
  </style>
</head>
<body>
  <div class="box"></div>
  <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
    <circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" style="fill: red" />
  </svg>
  <script type="text/javascript">
    const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
    const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
    
    svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
    svg.setAttribute('version', '1.1');

    circle.setAttribute('cx', 100);
    circle.setAttribute('cy', 50);
    circle.setAttribute('r', 40);
    circle.setAttribute('stroke', 'black');
    circle.setAttribute('stroke-width', 2);
    circle.setAttribute('fill', 'orange');
    svg.appendChild(circle);
    document.body.appendChild(svg);
  </script>
</body>
</html>